﻿using System;
using System.Collections.Generic;

namespace AppMain
{
    public class BaseMoveProcesser : IMoveProcesser
    {
        protected BoxRole agent;
        protected MoveData data;
        private float exitTime = 0;
        private float durTime = 0;

        public void init(BoxRole role)
        {
            this.agent = role;
        }
        public void enter(MoveData moveData, RoleMove_Status fromStatus)
        {
            this.data = moveData;
            this.exitTime = this.data.time;
            onEnter(fromStatus);
        }

        public void update(MoveData moveData)
        {
            this.data = moveData;
            this.exitTime = this.data.time;
            onUpdate();
        }

        public void exit(RoleMove_Status toStatus)
        {
            this.durTime = 0;
            this.exitTime = 0;
            onExit(toStatus);
        }

        protected bool timeIsArrive
        {
            get
            {
                return this.durTime >= this.exitTime;
            }
        }

        public void tick(float frameTime)
        {
            durTime += frameTime;
            onTick(frameTime);
        }

        public void dispose()
        {
            onDispose();
        }

        public void input(float x, float z)
        {

        }

        public void input(float value)
        {

        }


        protected virtual void onEnter(RoleMove_Status fromStatus)
        {

        }

        protected virtual void onUpdate()
        {

        }

        protected virtual void onExit(RoleMove_Status toStatus)
        {

        }

        protected virtual void onTick(float frameTime)
        {

        }

        protected virtual void onDispose()
        {

        }


    }
}
